﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FacadeSingTowerMall;
using DTOSingTowerMall;

namespace WebFormSingTowerMall.Approval
{
    public partial class ViewUserDetail : System.Web.UI.Page
    {
        ApprovalFacade af = new ApprovalFacade();
        string user = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserName"] != null)
            {
                //var detail = af.getUserDetail(Request.QueryString["UserName"]);
                //ViewUserDetailGridView.DataSource = detail;
                //ViewUserDetailGridView.DataBind();
            }
            ////Label1.Text = Request.QueryString["UserName"];

            //=======================================================
            //ValidateAuthentication();

            //if (Request.QueryString["UserName"] != null)
            //    user = Request.QueryString["UserName"].ToString();

             if (user !=null)
             LoadUserDetailInfo();



        }

        protected void btnViewEHBA_Click(object sender, EventArgs e)
        {
            Response.Redirect("../Approval/EventHallBookingApproval.aspx");
        }


        private void LoadUserDetailInfo()
        {
            //lblNoContactMgs.Visible = false;
            if (user != null)
            {
                    var detail = af.getUserDetail(Request.QueryString["UserName"]);
                    if (detail != null )
                    {
                        //ViewUserDetailGridView.DataSource = detail;
                        //ViewUserDetailGridView.DataBind(); 
                        IUserDetail ud = (IUserDetail)detail.First();
                        txtUserName.Text = ud.FullName;
                        txtContactNo.Text = ud.ContactNo;
                        txtGender.Text = ud.Gender;
                        txtDateOfBirth.Text = ud.DateofBirth.ToString();
                        txtAddress.Text = ud.Address;
                        txtFullName.Text = ud.FullName;
                    }
                    else
                    {
                       // ViewUserDetailGridView.Visible = false;
                        txtUserName.Visible = false;
                        txtContactNo.Visible = false;
                        txtGender.Visible = false;
                        txtDateOfBirth.Visible = false;
                        txtAddress.Visible = false;
                        txtFullName.Visible = false;
                    }
                }
            }
        }








  
    
}